package com.lancoo.ccas53.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lancoo.ccas53.config.MybatisRedisCache;
import com.lancoo.ccas53.entity.Student;
import com.lancoo.ccas53.pojo.excel.ExcelStudent;
import com.lancoo.ccas53.pojo.vo.AllScheduleVo;
import com.lancoo.ccas53.pojo.vo.ClassVo;
import com.lancoo.ccas53.pojo.vo.StudentTeachingClass;
import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;
import java.util.List;
import java.util.Set;

/**
 * <p>
 * 学生 Mapper 接口
 * </p>
 *
 * @author quin.song
 * @since 2024-05-20
 */
@CacheNamespace(implementation = MybatisRedisCache.class, eviction = MybatisRedisCache.class)
public interface StudentMapper extends BaseMapper<Student> {

    int addBatch(@Param("studentCollection") Collection<Student> studentCollection);

    List<ClassVo> getClassDto(@Param("taskId") Integer taskId, @Param("baseCollegeId") String baseCollegeId, @Param("majorId") String majorId, @Param("gradeId") String gradeId);

    /**
     * 获取全部学生 条件
     *
     * @param taskId
     * @param page
     * @param baseCollegeId
     * @param majorId
     * @param gradeId
     * @param classId
     * @param keyWord
     * @param selectionScopePre
     * @return
     */
    IPage<Student> getStudentByConditions(@Param("taskId") Integer taskId, @Param("page") IPage page, @Param("baseCollegeId") String baseCollegeId, @Param("majorId") String majorId,
                                          @Param("gradeId") String gradeId, @Param("classId") String classId, @Param("keyWord") String keyWord, @Param("selectionScope") Integer selectionScope,
                                          @Param("selectionScopePre") Integer selectionScopePre);

    /**
     * 获取指定教学班的学生
     *
     * @param page
     * @param teachingClassIds
     * @return
     */
    IPage<Student> getStudentByTeachingClassId(@Param("page") IPage page, @Param("teachingClassIds") List<Long> teachingClassIds,
                                               @Param("baseCollegeId") String baseCollegeId, @Param("gradeId") String gradeId,
                                               @Param("classId") String classId, @Param("keyword") String keyword);

    /**
     * 获取学生 课程教学班
     *
     * @return
     */
    List<StudentTeachingClass> getNormalCourseTeachingClass(@Param("teachingClassIds") List<Long> teachingClassIds, @Param("teachingClassType") Integer teachingClassType);

    /**
     * 获取学生无需选课的 环节教学班
     *
     * @return
     */
    List<StudentTeachingClass> getNormalSegmentTeachingClass(@Param("teachingClassIds") List<Long> teachingClassIds);

    /**
     * 获取学生可选教学班
     *
     * @param teachingClassType
     * @param courseIds
     * @param studyNature
     * @param studentId
     * @return
     */
    List<StudentTeachingClass> getTeachingClass(@Param("teachingClassType") Integer teachingClassType, @Param("courseIds") List<Long> courseIds,
                                                @Param("studyNature") Integer studyNature, @Param("studentId") Long studentId);

    List<StudentTeachingClass> getRetakeTeachingClass(@Param("teachingClassType") Integer teachingClassType,
                                                      @Param("courseIds") List<Long> courseIds, @Param("studyNature") Integer studyNature, @Param("studentId") Long studentId);


    /**
     * 获取学生选课设置信息
     *
     * @param studentId
     * @param studyNature
     * @return
     */
    Student getStudentInfoById(@Param("studentId") Long studentId, @Param("studyNature") Integer studyNature);

    List<Student> getAllStudent(Integer taskId, String keyword);

    List<Student> getClassStudent(Integer taskId, String keyword);

    IPage<AllScheduleVo> getAllStudentPage(Page<AllScheduleVo> page, Integer taskId, String gradeId, String classId, String keyword, String collegeId);

    List<com.lancoo.ccas53.pojo.dto.ExcelStudent> getExcelStudent(List<Long> teachingClassIds);

    Set<ExcelStudent> getStudentList(Integer taskId);

}
